<?php
/* @var $this AskController */
/* @var $model Ask */
/* @var $form CActiveForm */
?>

<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'ask-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
//	'enableAjaxValidation'=>true,
                     'clientOptions' => array(
                            'validateOnSubmit' => true,
                        ),
                    'enableClientValidation'=>TRUE,
)); ?>


	<?php // echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>300,'width'=>'200px'  ,'placeholder'=>Yii::t('ask/views', 'Please input title'))); ?>
		<?php echo $form->error($model,'title'); ?>
	</div><br/>

	<div class="row">
		<?php echo $form->textArea($model,'body',array('rows'=>6, 'cols'=>50)); ?>
        <script type="text/javascript">
			var editor = new UE.ui.Editor({toolbars:[['insertimage', 'emotion', 'scrawl']], initialFrameHeight:200});
			editor.render("Ask_body");
		</script>
		<?php echo $form->error($model,'body'); ?>
	</div>
    <?php if(yii::app()->user->checkAccess('admin')):?>
    <br/>
	<div class="row">
		<?php echo $form->labelEx($model,'isClose'); ?> : 
		<?php echo $form->dropDownList($model,'isClose',array('0'=>'开启问题','1'=>'关闭问题')); ?>
        <?php echo $form->error($model,'title'); ?>
        <p>注：关闭问题后，该问题将无法被回复。</p>
	</div><br/>
    <?php endif;?>
                    <div class="row">
                                      <?php if (CCaptcha::checkRequirements()): ?>
                                    <div>
                                        <?php echo $form->labelEx($model, 'verifyCode'); ?>
                                        <div>
                                            <?php echo $form->textField($model, 'verifyCode'); ?>
                                            <?php $this->widget('CCaptcha', array(
                                                        'clickableImage'=>true,
                                                        'showRefreshButton'=>false,
                                            )); ?>
                                        </div>
                                    </div>
                                    <?php echo $form->error($model, 'verifyCode'); ?>
                                <?php endif; ?>
                    </div>
                    <div class="row" hidden="hidden">
		<?php echo $form->labelEx($model,'tags'); ?>
		<?php echo $form->textField($model,'tags'); ?>
		<?php echo $form->error($model,'tags'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton( Yii::t('ask/views', 'Create') , array('class'=>'btn btn-primary')); ?>
        <?php if(!$model->isNewRecord):?>
            <a class="btn btn-primary" href="<?php echo yii::app()->baseUrl.'/ask/view/'.$model->ask_id?>">返回</a>
        <?php endif;?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
